{extend name='admin@main'}

{block name="content"}

{include file='store@device/form_style'}

<form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">

    <div class="layui-card-body think-box-shadow padding-left-40" >

        <div class="layui-form-item layui-row layui-col-space15" >

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">电桩名称</span>
                <input name="name" required class="layui-input" placeholder="请输入电桩名称" value="{$vo.name|default=''}">
            </label>
            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">电桩编号</span>
                <input name="sn" readonly class="layui-input" placeholder="请输入电桩编号" value="{$vo.sn|default=$sn}">
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">类型</span>
                <input name="brand" required class="layui-input" placeholder="请输入类型" value="{$vo.brand|default=''}">
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">如何获取经纬度？</span>
                <a target="_blank" href="{:sysconf('relam_name')}/map.html"><input style="cursor: pointer" readonly type="button" class="layui-input" placeholder="打开高德地图" value="打开高德地图"></a>
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">纬度</span>
                <input name="lat" required class="layui-input" placeholder="请输入纬度" value="{$vo.lat|default=''}">
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">经度</span>
                <input name="lng" required class="layui-input" placeholder="请输入经度" value="{$vo.lng|default=''}">
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">功率</span>
                <input name="rate" required class="layui-input" placeholder="请输入功率" value="{$vo.rate|default=''}">
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">速度 (快|慢)</span>
                <input name="speed" required class="layui-input" placeholder="请输入速度" value="{$vo.speed|default=''}">
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">备注详情</span>
                <input name="remark" required class="layui-input" placeholder="请输入备注详情" value="{$vo.remark|default=''}">
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">营业开始时间</span>
                <input type="time" name="start_time" required class="layui-input" placeholder="请输入营业开始时间" value="{$vo.start_time|default=''}">
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">营业结束时间</span>
                <input type="time" name="end_time" required class="layui-input" placeholder="请输入营业结束时间" value="{$vo.end_time|default=''}">
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">营业开始时间2</span>
                <input type="time" name="start_time2"  class="layui-input" placeholder="请输入营业开始时间2" value="{$vo.start_time2|default=''}">
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">营业结束时间2</span>
                <input type="time" name="end_time2"  class="layui-input" placeholder="请输入营业结束时间2" value="{$vo.end_time2|default=''}">
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">营业开始时间3</span>
                <input type="time" name="start_time3"  class="layui-input" placeholder="请输入营业开始时间3" value="{$vo.start_time3|default=''}">
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">营业结束时间3</span>
                <input type="time" name="end_time3"  class="layui-input" placeholder="请输入营业结束时间3" value="{$vo.end_time3|default=''}">
            </label>

            <label class="layui-col-xs3 relative" style="width:30%">
                <span class="color-green">状态</span>
                <select style="width: 100%" name='status' required class='layui-select' lay-search>
                    {foreach [['id'=>'1','title'=>'正常'],['id'=>'2','title'=>'故障'],['id'=>'3','title'=>'被使用'],['id'=>'4','title'=>'停用']] as $cate}
                    {if isset($vo.status) and $vo.status eq $cate.title}
                    <option selected value="{$cate.id}">{$cate.title|default=''}</option>
                    {else}
                    <option value="{$cate.id}">{$cate.title|default=''}</option>
                    {/if}
                    {/foreach}
                </select>
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">尖单价(元)</span>
                <input name="price" required class="layui-input" placeholder="请输入尖单价" value="{$vo.price|default=''}">
            </label>
            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">尖服务费(元)</span>
                <input name="service_price" required class="layui-input" placeholder="请输入尖服务费" value="{$vo.service_price|default=''}">
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">峰单价(元)</span>
                <input name="price2" required class="layui-input" placeholder="请输入峰单价" value="{$vo.price2|default=''}">
            </label>
            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">峰服务费(元)</span>
                <input name="service_price2" required class="layui-input" placeholder="请输入峰服务费" value="{$vo.service_price2|default=''}">
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">平单价(元)</span>
                <input name="price3" required class="layui-input" placeholder="请输入平单价" value="{$vo.price3|default=''}">
            </label>
            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">平服务费(元)</span>
                <input name="service_price3" required class="layui-input" placeholder="请输入平服务费" value="{$vo.service_price3|default=''}">
            </label>

            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">谷单价(元)</span>
                <input name="price4" required class="layui-input" placeholder="请输入谷单价" value="{$vo.price4|default=''}">
            </label>
            <label class="layui-col-xs9 relative" style="width:30%">
                <span class="color-green">谷服务费(元)</span>
                <input name="service_price4" required class="layui-input" placeholder="请输入谷服务费" value="{$vo.service_price4|default=''}">
            </label>

            <div class="layui-form-item">
                <span class="color-green label-required-prev">图片</span>
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th class="text-left">图片</th>
                        <th class="text-left" style="display:none;">导航图</th>
                        <th class="text-left">展示图片</th>
                    </tr>
                    <tr>
                        <td width="90px" class="text-left"><input name="pic" type="hidden" value="{$vo.pic|default=''}"></td>
                        <td width="90px" class="text-left" style="display:none;"><input name="map_image" type="hidden" value="{$vo.map_image|default=''}"></td>
                        <td width="auto" class="text-left"><input name="images" type="hidden" value="{$vo.images|default=''}"></td>
                    </tr>
                    </thead>
                </table>
                <script>$('[name="pic"]').uploadOneImage(),$('[name="map_image"]').uploadMultipleImage(), $('[name="images"]').uploadMultipleImage()</script>
            </div>

            <label class="layui-col-xs3 relative" style="width:30%;display: <?php if($title=='编辑'){ echo 'none';} ?>">
                <span class="color-green">车位列表</span>
                <select style="width: 95%" name='park_id' required class='layui-select' lay-search>
                    {foreach $park_list as $cate}
                    {if isset($vo.park_id) and $vo.park_id eq $cate.id}
                    <option selected value="{$cate.id}">{$cate.name|default=''}</option>
                    {else}
                    <option value="{$cate.id}">{$cate.name|default=''}</option>
                    {/if}
                    {/foreach}
                </select>
            </label>

            <label class="layui-col-xs3 relative" style="width:50%">
                <style>
                    .inp{ width: 50px}
                </style>
                <table style="width: 80%">
                    <tr>
                        <td>0:00~0:30</td>
                        <td>0:30~1:00</td>
                        <td>1:00~1:30</td>
                        <td>1:30~2:00</td>
                        <td>2:00~2:30</td>
                        <td>2:30~3:00</td>
                        <td>3:00~3:30</td>
                        <td>3:30~4:00</td>
                    </tr>
                    <tr>
                        <?php for($i=0;$i<8;$i++){ ?>
                        <td >
                            <select class="inp" id="cost<?php echo $i; ?>">
                                <option value="0" <?php if($vo['cost'][$i]<1){ echo 'selected'; } ?>>未选择</option>
                                <option value="1" <?php if($vo['cost'][$i]==1){ echo 'selected'; } ?>>尖</option>
                                <option value="2" <?php if($vo['cost'][$i]==2){ echo 'selected'; } ?>>峰</option>
                                <option value="3" <?php if($vo['cost'][$i]==3){ echo 'selected'; } ?>>平</option>
                                <option value="4" <?php if($vo['cost'][$i]==4){ echo 'selected'; } ?>>谷</option>
                            </select>
                        </td>
                        <?php }?>
                    </tr>
                    <tr>
                        <td>4:00~0:30</td>
                        <td>4:30~5:00</td>
                        <td>5:00~5:30</td>
                        <td>5:30~6:00</td>
                        <td>6:00~6:30</td>
                        <td>6:30~7:00</td>
                        <td>7:00~7:30</td>
                        <td>7:30~8:00</td>
                    </tr>
                    <tr>
                        <?php for($i=8;$i<16;$i++){ ?>
                        <td>
                            <select class="inp" id="cost<?php echo $i; ?>">
                                <option value="0" <?php if($vo['cost'][$i]<1){ echo 'selected'; } ?>>未选择</option>
                                <option value="1" <?php if($vo['cost'][$i]==1){ echo 'selected'; } ?>>尖</option>
                                <option value="2" <?php if($vo['cost'][$i]==2){ echo 'selected'; } ?>>峰</option>
                                <option value="3" <?php if($vo['cost'][$i]==3){ echo 'selected'; } ?>>平</option>
                                <option value="4" <?php if($vo['cost'][$i]==4){ echo 'selected'; } ?>>谷</option>
                            </select>
                        </td>
                        <?php }?>
                    </tr>
                    <tr>
                        <td>8:00~8:30</td>
                        <td>8:30~9:00</td>
                        <td>9:00~9:30</td>
                        <td>9:30~10:00</td>
                        <td>10:00~10:30</td>
                        <td>10:30~11:00</td>
                        <td>11:00~11:30</td>
                        <td>11:30~12:00</td>
                    </tr>
                    <tr>
                        <?php for($i=16;$i<24;$i++){ ?>
                        <td>
                            <select class="inp" id="cost<?php echo $i; ?>">
                                <option value="0" <?php if($vo['cost'][$i]<1){ echo 'selected'; } ?>>未选择</option>
                                <option value="1" <?php if($vo['cost'][$i]==1){ echo 'selected'; } ?>>尖</option>
                                <option value="2" <?php if($vo['cost'][$i]==2){ echo 'selected'; } ?>>峰</option>
                                <option value="3" <?php if($vo['cost'][$i]==3){ echo 'selected'; } ?>>平</option>
                                <option value="4" <?php if($vo['cost'][$i]==4){ echo 'selected'; } ?>>谷</option>
                            </select>
                        </td>
                        <?php }?>
                    </tr>
                    <tr>
                        <td>12:00~12:30</td>
                        <td>12:30~13:00</td>
                        <td>13:00~13:30</td>
                        <td>13:30~14:00</td>
                        <td>14:00~14:30</td>
                        <td>14:30~15:00</td>
                        <td>15:00~15:30</td>
                        <td>15:30~16:00</td>
                    </tr>
                    <tr>
                        <?php for($i=24;$i<32;$i++){ ?>
                        <td>
                            <select class="inp" id="cost<?php echo $i; ?>">
                                <option value="0" <?php if($vo['cost'][$i]<1){ echo 'selected'; } ?>>未选择</option>
                                <option value="1" <?php if($vo['cost'][$i]==1){ echo 'selected'; } ?>>尖</option>
                                <option value="2" <?php if($vo['cost'][$i]==2){ echo 'selected'; } ?>>峰</option>
                                <option value="3" <?php if($vo['cost'][$i]==3){ echo 'selected'; } ?>>平</option>
                                <option value="4" <?php if($vo['cost'][$i]==4){ echo 'selected'; } ?>>谷</option>
                            </select>
                        </td>
                        <?php }?>
                    </tr>
                    <tr>
                        <td>16:00~16:30</td>
                        <td>16:30~17:00</td>
                        <td>17:00~17:30</td>
                        <td>17:30~18:00</td>
                        <td>18:00~18:30</td>
                        <td>18:30~19:00</td>
                        <td>19:00~19:30</td>
                        <td>19:30~20:00</td>
                    </tr>
                    <tr>
                        <?php for($i=32;$i<40;$i++){ ?>
                        <td>
                            <select class="inp" id="cost<?php echo $i; ?>">
                                <option value="0" <?php if($vo['cost'][$i]<1){ echo 'selected'; } ?>>未选择</option>
                                <option value="1" <?php if($vo['cost'][$i]==1){ echo 'selected'; } ?>>尖</option>
                                <option value="2" <?php if($vo['cost'][$i]==2){ echo 'selected'; } ?>>峰</option>
                                <option value="3" <?php if($vo['cost'][$i]==3){ echo 'selected'; } ?>>平</option>
                                <option value="4" <?php if($vo['cost'][$i]==4){ echo 'selected'; } ?>>谷</option>
                            </select>
                        </td>
                        <?php }?>
                    </tr>
                    <tr>
                        <td>20:00~20:30</td>
                        <td>20:30~21:00</td>
                        <td>21:00~21:30</td>
                        <td>21:30~22:00</td>
                        <td>22:00~22:30</td>
                        <td>22:30~23:00</td>
                        <td>23:00~23:30</td>
                        <td>23:30~24:00</td>
                    </tr>
                    <tr>
                        <?php for($i=40;$i<48;$i++){ ?>
                        <td>
                            <select class="inp" id="cost<?php echo $i; ?>">
                                <option value="0" <?php if($vo['cost'][$i]<1){ echo 'selected'; } ?>>未选择</option>
                                <option value="1" <?php if($vo['cost'][$i]==1){ echo 'selected'; } ?>>尖</option>
                                <option value="2" <?php if($vo['cost'][$i]==2){ echo 'selected'; } ?>>峰</option>
                                <option value="3" <?php if($vo['cost'][$i]==3){ echo 'selected'; } ?>>平</option>
                                <option value="4" <?php if($vo['cost'][$i]==4){ echo 'selected'; } ?>>谷</option>
                            </select>
                        </td>
                        <?php }?>
                    </tr>
                </table>

                <div id="tishi" style="color: red">提示：未确认计费模型</div>
                <input type="hidden" id="cost_model" name="cost_model" value="">
                <div style="cursor: pointer;color: blue;" onclick="queren()"><span style="border-bottom: 1px solid blue ">确认</span></div>

            </label>


        </div>



        <div class="layui-form-item text-center">
            {notempty name='vo.id'}<input type="hidden" name="id" value="{$vo.id}">{/notempty}
            <button class="layui-btn layui-btn-danger" ng-click="hsitoryBack()" type="button">取消编辑</button>
            <button class="layui-btn" type="submit">保存</button>
        </div>

    </div>
</form>
{/block}

{block name='script'}
<script>
    window.form.render();
    var cost = [];
    queren();
    function queren() {
        cost = [];
        for (var i=0;i<48;i++){
            cost.push($("#cost"+i).val())
        }
        $("#cost_model").val(JSON.stringify(cost))
        $("#tishi").html('提示:计费模型已确认')
    }
</script>

{/block}